﻿//-------------------------------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2011 , JamSoft TECH, Ltd .
//-------------------------------------------------------------------------------------
using System;

/// <remarks>
/// Messages
/// 信息窗口
/// 
/// 修改纪录
/// 
///	版本：1.0 2011.08.27 LiangMingMing  创建代码。 
/// <author>
///		<name>LiangMingMing</name>
///		<date>2011.08.27</date>
/// </author> 
/// </remarks>
public partial class Messages : System.Web.UI.Page
{
    // **********************************************************************************************
    // *                                                                                            * 
    // *                             Public Variate    公共变量                                     *
    // *                                                                                            * 
    // **********************************************************************************************

    /// <summary>
    /// 提示框标题
    /// </summary>
    protected string Mtitle = string.Empty;
    /// <summary>
    /// 提示框内容
    /// </summary>
    protected string Mbody = string.Empty;
    /// <summary>
    /// 提示框内容
    /// </summary>
    protected string MessageType = string.Empty;

    // **********************************************************************************************
    // *                                                                                            * 
    // *                                       Method   操作方法                                    * 
    // *                                                                                            * 
    // **********************************************************************************************

    #region private void GetParamter() 读取参数
    /// <summary>
    /// 读取参数
    /// </summary>
    private void GetParamter()
    {
        if (Page.Request["MessageType"] != null)
        {
            MessageType = Page.Request["MessageType"].ToString();
        }
        if (Page.Request["Mtitle"] != null)
        {
            Mtitle = Page.Request["Mtitle"].ToString();
        }
        if (Page.Request["Mbody"] != null)
        {
            Mbody = Page.Request["Mbody"].ToString();
        }
        if (Page.Request["MbuttonUrl"] != null)
        {
            this.txtMbuttonUrl.Value = Page.Request["MbuttonUrl"].ToString();
        }
    }
    #endregion

    // **********************************************************************************************
    // *                                                                                            * 
    // *                                       EventArgs    事件方法                                * 
    // *                                                                                            * 
    // ********************************************************************************************** 

    #region protected void Page_Load(object sender, EventArgs e) 页面初次加载的动作
    /// <summary>
    /// 页面初次加载的动作
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // 读取参数
            this.GetParamter();
            if (MessageType.Equals("MessageError"))
            {
                this.imgMassage.ImageUrl = "../../../../Images/Login/MessageIcon/MessageError.gif";
            }
            else if (MessageType.Equals("MessageAlert"))
            {
                this.imgMassage.ImageUrl = "../../../../Images/Login/MessageIcon/MessageAlert.gif";
            }
            else
            {
                this.imgMassage.ImageUrl = "../../../../Images/Login/MessageIcon/MessageOk.gif";
            }
        }
    }
    #endregion

    #region protected void btnConfirm_Click(object sender, EventArgs e) 确认
    /// <summary>
    /// 确认
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(this.txtMbuttonUrl.Value) && !this.txtMbuttonUrl.Value.Equals("return"))
        {
            // 跳转页面
            Page.Response.Redirect(this.txtMbuttonUrl.Value);
        }
        if (!string.IsNullOrEmpty(this.txtMbuttonUrl.Value) && this.txtMbuttonUrl.Value.Equals("return"))
        {
            //返回上一页
            Response.Write("<script language=javascript>history.go(-2);</script>");
        }
    }
    #endregion
}
